<%@ page import="java.util.Vector" %>
<%@ page import="com.dsj.cart.CartGoods" %><%--
  修改购物车中的商品信息
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    Vector cart=(Vector)session.getAttribute("__CART__");
    Vector newcart=new Vector();
    for(int i=0;i<cart.size();i++){
        CartGoods cartGoods=(CartGoods)cart.elementAt(i);
        String num=request.getParameter("num"+i);
        try{
            int newnum=Integer.parseInt(num);
            cartGoods.number=newnum;

            if(newnum!=0){
                newcart.addElement(cartGoods);}
        }catch(Exception e){
            out.println("<script language='javascript'>alert('您输入的数量不是有效的整数!');history.back(); </script>");
            return;
        }
    }
    session.setAttribute("__CART__",newcart);
    response.sendRedirect("cartShow.jsp");
%>
